import React from 'react';
import laba from '@site/static/img/喇叭.png';


class PlayAudio extends React.Component {

    startPlay = () => {
        document.querySelector("#" + this.props.id).play();
    }
    render() {
        return (<div style={{position:'relative',display:'inline-block', width: this.props.width, height: this.props.height}}>
            <audio src={this.props.src} id={this.props.id}></audio>
            <img src={laba} style={{ width: this.props.width, height: this.props.height,position:'absolute',top: '6px',left: '3px' }} onClick={this.startPlay} />
        </div>)
    }

}

PlayAudio.defaultProps = {
    width: '20px',
    height: '20px',
}

export default PlayAudio;